package com.wt.controller;

import com.wt.pojo.User;
import org.springframework.web.bind.annotation.*;

import java.util.Arrays;
import java.util.Date;
import java.util.List;

@RestController
@RequestMapping("user")
public class UserController {
    @PostMapping
    public String add(@RequestBody User u) {
        System.out.println("----------提供者添加--------------user="+u);
        return "add ok";
    }

    @DeleteMapping("/{id}")
    public String delete(@PathVariable("id") Integer uid) {
        System.out.println("----------提供者删除--------------uid="+uid);
        return "delete ok";
    }

    @PutMapping
    public String update(@RequestBody User u) {
        System.out.println("----------提供者修改--------------user="+u);
        return "update ok";
    }


    @GetMapping
    public List<User> list(String name, Integer age) {
        System.out.println("提供者==name"+name+"  age="+age);
        return Arrays.asList(new User(1, "lx", 31, new Date()), new User(2, "lxx", 32, new Date()));
    }

}
